package com.example.view.activity;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.example.common.base.AbsActivity;
import com.example.common.utils.L;
import com.example.view.R;
import com.example.view.adapter.CityAdapter;
import com.example.view.bean.CityBean;
import com.example.view.data.CityDao;
import com.example.view.databinding.ActCityBinding;

import java.util.List;

@Route(path = "/view/city")
public class CityActivity extends AbsActivity<ActCityBinding> {

    @Override
    protected int getLayoutId() {
        return R.layout.act_city;
    }

    @Override
    protected void main() {
        init();
        initRecyclerView();
        CityDao dao = new CityDao();
        List<CityBean> region = dao.getRegion(null);
        for (CityBean city : region) {
            L.e("" + city.toString());
        }
    }

    private void init() {
        setTitle("City Realm");
    }

    private void initRecyclerView() {
        CityAdapter adapter = new CityAdapter();
        mBinding.rv.setLayoutManager(new LinearLayoutManager(this));
        mBinding.rv.setAdapter(adapter);
    }

    @Override
    protected void initListener() {

    }
}
